#include "KeyboardSubject.h"


KeyboardSubject::KeyboardSubject(void)
{
}


KeyboardSubject::~KeyboardSubject(void)
{
}

void KeyboardSubject::AddKeyboardListener( KeyboardListener *listener )
{
	keyboardListeners.insert(listener);
}

void KeyboardSubject::DeleteKeyboardListener( KeyboardListener *listener )
{
	keyboardListeners.erase(listener);
}

void KeyboardSubject::KeyboardNotify(KeyboadMsg msg)
{
	std::set<KeyboardListener*>::const_iterator iter;
	for(iter=keyboardListeners.begin(); iter!=keyboardListeners.end() ;++iter)
		(*iter)->KeyboardUpdate(msg);
}

KeyboardSubject* KeyboardSubject::Instance()
{
	static KeyboardSubject* m_instance = NULL;
	if(!m_instance)
		m_instance = new KeyboardSubject();
	return m_instance;
}
